import React from "react";
import ReactDOM from "react-dom/client";
import { describe, it, expect } from "@jest/globals";
import { render, screen } from "@testing-library/react";

import { Input } from '../input'

describe("Check DOM render", () => {
  it("simple test", () => {
    const { container: node } = render(<Input value="111" />)

    expect(node).toMatchSnapshot();
  });

  it("input with error", () => {
    const ref = { current: null }
    const { container: node } = render(<Input ref={ref} value="111" error="Ошибка" />)
    screen.getByText(/ошибка/i)

    expect(node).toMatchSnapshot();
    expect(ref).toMatchSnapshot();
  });
});
